/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.webhomesites.locacao.model;

import br.com.webhomesites.locacao.contracts.ILocacaoBO;
import br.com.webhomesites.locacao.contracts.ILocacaoView;
import br.com.webhomesites.locacao.presenter.LocacaoPresenter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author Webhome
 */
public class LocacaoBO implements ILocacaoBO {

    LocacaoPresenter locacaoPresenter;
    ILocacaoView locacaoView;
    LocacaoModel locacaoModel;
    
    public LocacaoBO(LocacaoPresenter locacaoPresenter) {
        this.locacaoPresenter = locacaoPresenter;
        this.locacaoView = locacaoPresenter.getLocacaoView();
        this.locacaoModel = locacaoPresenter.getLocacaoModel();
    }
    
    
    @Override
    public void setCalcDataPrevDevolucao() {

            System.out.println("Apertou Enter");
            Calendar cal = Calendar.getInstance();
            System.out.println("Dias Locação " + locacaoView.getDiasLocacao());  // Depois de amanhã
            cal.add(Calendar.DATE, locacaoView.getDiasLocacao());
            Date date = cal.getTime();
            DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            locacaoView.setDataPrevDevolucao(formatter.format(date));
       
    }
    
}
